<?php
namespace app\index\controller;
use app\BaseController;
use think\facade\View;
use think\request;
use think\facade\Db;
use app\service\orderService;
use app\service\chargeRuleService;
use app\service\apiService;
use app\service\wechatService;
use think\facade\Log;
error_reporting(0);
//ini_set('default_socket_timeout',30);

class Order extends BaseController{


    //停车客户端预支付
    public function prepay(){
        //判断是不是微信
        if (strpos($_SERVER['HTTP_USER_AGENT'], 'MicroMessenger') !== false ) {
            $id=request()->get("id");
            $url=$this->getCurrentUrl()."/index/orderwx/carquery?id=".$id;
          	header("Location:".$url);
		    exit;
        }
        
        //判断是不是支付宝
        if (strpos($_SERVER['HTTP_USER_AGENT'], 'AlipayClient') !== false) {
			
            $id=request()->get("id");
            $url=$this->getCurrentUrl()."/index/orderali/carquery?id=".$id;
            header("Location:".$url);
		    exit;
		}
        
        
    }
	//出口扫码支付
	public function outpay(){
        //判断是不是支付宝
        if (strpos($_SERVER['HTTP_USER_AGENT'], 'AlipayClient') !== false) {
            $id=request()->get("id");
            $url=$this->getCurrentUrl()."/index/orderali/outpay?id=".$id;
      	    header("Location:".$url);
		}
		//判断是不是微信
        if (strpos($_SERVER['HTTP_USER_AGENT'], 'MicroMessenger') !== false ) {
		    $id=request()->get("id");

            $url=$this->getCurrentUrl()."/index/orderwx/outpay?id=".$id;
            header("Location:".$url);
        }
        
        //哪个都不是微信
        return "请使用支付宝扫码";
	    
	}
    public function success(){
        session(null);
        return "支付成功";
        return View::fetch();
    }

    
}